<html lang="en">
<head>
    <title>攻略评论管理</title>
    <#include "../common/header.ftl">
    <script type="text/javascript" src="/js/plugins/jquery-form/jquery.form.js"></script>
    <script>
        $(function () {
            $('.inputBtn').click(function () {//修改状态模态框
                var json = $(this).data("json");
                console.log(json);
                if(json) {
                    $("#editForm input[name='id']").val(json.id)
                    $("#editForm select[name='state']").val(json.state)
                }

                $('#editModal').modal("show")
            })
            //修改状态的保存
            $('.saveBtn').click(function () {
                $("#editForm").ajaxSubmit(function (data) {
                    window.location.reload();
                })
            })
        })
    </script>
</head>
<body>
<!--左侧菜单回显变量设置-->
<#assign currentMenu="strategyComment">
<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">攻略评论管理</h1>
                </div>
            </div>
            <form class="form-inline" id="searchForm" action="/strategyComment/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
            </form>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>评论者</th>
                    <th>时间</th>
                    <th>图片</th>
                    <th>星级</th>
                    <th>攻略</th>
                    <th>状态</th>
                    <th>内容</th>
                    <th>编辑</th>
                </tr>
                </thead>
               <#list result.list as entity >
                     <tr>
                         <td width="10%">${entity_index+1}</td>
                         <td width="10%">${(entity.user.nickName)!}</td>
                         <td  width="15%">${(entity.createTime?string("yyyy-MM-dd"))!}</td>
                         <td>
                             <#list entity.imgUrls?split(";") as img>
                                <img src="${img}" width='50px' style='margin-right:5px'>
                             </#list>
                         </td>
                         <td width="10%">${(entity.starNum)!}</td>
                         <td width="10%">${(entity.strategy.title)!}</td>
                         <td width="10%">${(entity.stateString)!}</td>
                         <td width="30%">${entity.content!}</td>
                         <td>
                             <a href="javascript:;" class="btn editStrategyCatalogBtn inputBtn" data-json='${entity.jsonString}'>修改状态</a>
                         </td>
                     </tr>
                </#list>
            </table>
            <#include "../common/page.ftl">
        </div>
    </div>
</div>

<#--评论更改状态模态框-->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span> </button>
                <h4 class="modal-title">评论状态编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/strategyComment/saveOrUpdate.do" method="post" enctype="multipart/form-data" id="editForm">
                    <input type="hidden" name="id">
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">状态：</label>
                        <div class="col-sm-6">
                            <select name="state" class="form-control">
                                <option value="-1">--请选择--</option>
                                <option value="0">正常</option>
                                <option value="1">推荐</option>
                                <option value="2">禁用</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary saveBtn" >保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
